package com.zhou.transaction;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLDataException;
import java.sql.SQLException;

import com.zhou.jdbc.JdbcUtils;

public class AccountDao {
	public void updateBalance(Connection con,String name, double balance){

		PreparedStatement pstmt = null;
		try{

			String sql = "UPDATE account SET balance = balance + ? WHERE NAME = ?";
			pstmt = con.prepareStatement(sql);
			pstmt.setDouble(1, balance);
			pstmt.setString(2, name);
			pstmt.executeUpdate();
		}catch (Exception e) {
			e.printStackTrace();
		}
	}
}
